Hi all,
I have a script that gives me a list of modules, attributes, views etc. in a selected project/folder.
A user can specify in a DB what he wants listed.
But when he selects a new project/folder with the DB open, the previously selected project/folder is still treated as the current item.
How can I get the new current item? Trying to refresh with "current Project" does not seem to work.
Any ideas?
Karl
kabr - Wed Jul 14 07:49:22 EDT 2010 |
|
Re: Current Folder Changed Mathias Mamsch - Wed Jul 14 09:50:52 EDT 2010
current Object and current Project are set when you start your DXL script and will not change, when you change your selection in the database explorer. The undocumented DXL functions you are probably looking for are (if by DB you meant database explorer, not a custom dialog box):
Item getTreeSelectedItem()
Item getSelectedItem()
These will give you the currently selected Items in the DB explorer. The first one gives you the selected item in the folder tree, the second one the selected item in the module list.
Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
|
Re: Current Folder Changed llandale - Wed Jul 14 09:52:30 EDT 2010
This is a long running issue of changing the context of a dialog. I do not. The context of the dialog is set when its created and I leave it that way. In this case, close the dialog, select the new folder, and open it again. I always display the context of a dialog in Labels at the top (current module, current folder).
There is a way to figure out what's currently selected in the Explorer, I just don't recall how.
|
|
Re: Current Folder Changed llandale - Wed Jul 14 10:57:13 EDT 2010 Mathias Mamsch - Wed Jul 14 09:50:52 EDT 2010
current Object and current Project are set when you start your DXL script and will not change, when you change your selection in the database explorer. The undocumented DXL functions you are probably looking for are (if by DB you meant database explorer, not a custom dialog box):
Item getTreeSelectedItem()
Item getSelectedItem()
These will give you the currently selected Items in the DB explorer. The first one gives you the selected item in the folder tree, the second one the selected item in the module list.
Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
... or using Left Pane/Right Pane, the following prints what's selected:
Item iLeft = getTreeSelectedItem()
Item iRight = getSelectedItem()
if (!null iLeft) //
then print "Left\t" (name(iLeft)) "\n"
else print "Left\tNothing\n"
if (!null iRight) //
then print "Right\t" (name(iRight)) "\n"
else print "Right\tNothing\n"
So the Left Pane select determines the 'current Folder', which would be of interest to you. Folder fCurr = folder(fullName(getTreeSelectedItem())).
I see that when nothing is selected in the right pane, that perm returns what's selected in the left
|
|
Re: Current Folder Changed kabr - Thu Jul 15 10:48:30 EDT 2010
Thanks Mathias, Louie,
that's what I was looking for.
And yes, Louie, I would rather not change the context of a dialog box, but somehow I am obliged to please my customers (users), you know.
Karl
|
|
Re: Current Folder Changed llandale - Thu Jul 15 18:05:12 EDT 2010 kabr - Thu Jul 15 10:48:30 EDT 2010
Thanks Mathias, Louie,
that's what I was looking for.
And yes, Louie, I would rather not change the context of a dialog box, but somehow I am obliged to please my customers (users), you know.
Karl
So all your dialog callback functions, either by 'button' or by 'apply', need to check for the current context and go from there. I'd be very tempted to have the context labeled on the dialog and remembered by the script, and if the new context is different then JUST update the dialog and warn the user, forcing her to hit the button a 2nd time (after changing contexts). Thus, the script only actually works for the currently DISPLAYED context, helping to prevent the user from shooting herself in the foot.
|
|